// 16进制转buffer
function hex_to_buffer(__array){
  if(!Array.isArray(__array)){
    return hex_array([__array])
  }
  var hex_array = __array.map(el=>parseInt(el, 16))
  var uarray = new Uint8Array(hex_array)
  return Buffer.from(uarray)
}


// buffer转16进制
function buffer_to_hex(__buffer){
  var uarray = Array.prototype.slice.call(__buffer)
  return uarray.map(el=>Number(el).toString(16))
}

module.exports = {
  hex_to_buffer,
  buffer_to_hex
}